package tw.edu.tku.im.maze;

import org.json.JSONException;
import org.json.JSONObject;

public class RegisterReq extends ReqPacket {
   String userID;
   String name;
   String password;
   
   public RegisterReq(String userID, String name, String password) {
      this.userID = userID;
      this.name = name;
      this.password = password;
   }
   
   public String getUserID() {
      return this.userID;
   }
   
   public void setName(String name) {
      this.name = name;
   }
   public String getName() {
      return this.name;
   }
   
   public void setPassword(String password) {
      this.password = password;
   }
   public String getPassword() {
      return this.password;
   }
   
   public String toJSONString() throws JSONException {
      JSONObject parameter = new JSONObject();
      parameter.put("userID", this.userID);
      parameter.put("name", this.name);
      parameter.put("password", this.password);
      JSONObject jsonObj = new JSONObject();
      jsonObj.put("action", "register");
      jsonObj.put("parameter", parameter);
      return jsonObj.toString();
   }

   @Override
   public String getPacketName() {
      return "register";
   }
   
}
